package com.admin.education.models;

import com.admin.education.repositories.Identifiable;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

@Entity
@Table(name = "designations")
@EntityListeners(AuditingEntityListener.class)
@Data
public class Designations implements Serializable, Identifiable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
    @Column(name="name")
    @Length(max = 32)
    @NotNull
    private String name;
    @DecimalMin("0")
    @DecimalMax("100")
    @Column(name="proportion")
    @NotNull
    private BigDecimal proportion;
    @Column(name="valid")
    @NotNull
    private boolean valid;

}
